package easy.id_101_200;

public class lee125 {
    public static void main(String[] args) {
        String s = " ";
        System.out.println(isPalindrome(s));
        System.out.println(arePairedCaseCharacters('a', 'A'));
    }

    public static boolean isPalindrome(String s) {
        int left=0,right=s.length()-1;
        //注意一些string的api
        while(left<=right){
            while(left<s.length() && !Character.isDigit(s.charAt(left)) && !Character.isAlphabetic(s.charAt(left))){
                left++;
            }

            while(right>=0 && !Character.isDigit(s.charAt(right)) && !Character.isAlphabetic(s.charAt(right))){
                right--;
            }
            if(left<=right && Character.toLowerCase(s.charAt(left)) != Character.toLowerCase(s.charAt(right))){
                return false;
            }
            left++;
            right--;
        }
        return true;

    }
    // 判断是否是配对的大小写
    public static boolean arePairedCaseCharacters(char c1, char c2) {
        return Character.toLowerCase(c1) == Character.toLowerCase(c2);
    }

}
